<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .container {
      width: 100%;
      height: 100vh;
      background-color: black;
    }

    .box {
      position: absolute;
      left: 0;
      width: 40px;
      height: 40px;
      background-color: pink;
      border-radius: 50%;
    }
  </style>
</head>

<body>
  <div class="container">
    <div class="box"></div>
  </div>
  <script>
    const box = document.querySelector('.box')
    let dist = 0
    let pre = 0
    function step(timestamp) {
      box.style.left = dist + 'px'
      dist += 10
      if (timestamp - pre > 16) {
        pre = timestamp
        requestAnimationFrame(step)
      }
    }
    requestAnimationFrame(step)
  </script>
</body>

</html>